{% extends 'base.html' %}

{% block title %}发布授课{% endblock %}

{% block head %}
    <script src="{% static 'jquery/jquery-3.7.1.min.js' %}"></script>
    <link rel="stylesheet" href="{% static 'wangeditor/style.css' %}">
    <script src="{% static 'wangeditor/index.js' %}"></script>
    <script src="{% static 'js/add_tech.js' %}"></script>
    <style>
        #editor—wrapper {
            border: 1px solid #ccc;
            z-index: 100; /* 按需定义 */
        }

        #toolbar-container {
            border-bottom: 1px solid #ccc;
        }

        #editor-container {
            height: 500px;
        }
    </style>
{% endblock %}


{% block main %}
    <h1>发布授课</h1>
    <div class="mt-3">
        <form action="" method="POST">
            <div class="mb-3">
                <label>课程</label>
                <select name="courseid" id="courseid-selected">
                    <option value="">请选择课程</option>
                    {% for course in courses %}
                        <option value="{{ course.id }}">{{ course.name }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="mb-3">
                <label>教师</label>
                <select name="class_id" id="teacherid-selected">
                    <option value="">请选择教师</option>
                    {% for teacher in teachers %}
                        <option value="{{ teacher.user.id }}">{{ teacher.user.username }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="mb-3">
                <label>班级</label>
                <select name="class_id" id="class_id-selected">
                    <option value="">请选择班级</option>
                    {% for class in classes %}
                        <option value="{{ class.id }}">{{ class.name }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="mb-3">
                <label>教材</label>
                <select name="textid" id="textid-selected">
                    <option value="">请选择教材</option>
                    {% for textbook in textbooks %}
                        <option value="{{ textbook.id }}">{{ textbook.name }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="mb-3">
                <label>学年</label>
                <input style="height: 30px" type="text" name="year" class="form-control" placeholder="学年">
            </div>

            <div class="mb-3">
                <label>学期</label>
                <input style="height: 30px" type="text" name="semester" class="form-control" placeholder="学期">
            </div>

            <div class="mb-3">
                <label class="form-label">简介</label>
                <div id="editor—wrapper">
                    <div id="toolbar-container"><!-- 工具栏 --></div>
                    <div id="editor-container"><!-- 编辑器 --></div>
                </div>
            </div>
            <div class="mb-3 text-end">
                <button class="btn btn-primary" id="submit-btn">发布</button>
            </div>
        </form>
    </div>
{% endblock %}